<?php
require_once "dbconn.php";
$data=array();

//全部
$sql = "SELECT CONCAT(0 + sum(amount)) as value from o_order WHERE id in(SELECT oo.id FROM o_order oo LEFT JOIN o_order_list ool ON ool.order_id = oo.id WHERE
 date_format(oo.create_time, '%Y-%m') = date_format(now(), '%Y-%m') AND ( oo.STATUS = 7 OR oo.`status` = 2 OR oo.`status` = 3 OR oo.`status` = 4 OR oo.`status` = 5) AND ool.goods_id != 35 GROUP BY ool.order_id )";

//echo $sql."<br/>";


$query=$mysqli->query($sql);
$res=mysqli_fetch_array($query);



//今天
$sql1 = "select sum(amount)  as value from o_order where   date_format(create_time,'%Y-%m-%d')=date_format(now(),'%Y-%m-%d')  and  ( status=7 or `status`=2 or `status`=3 or `status`=4 or `status`=5 ) ";


$query1=$mysqli->query($sql1);
$res1=mysqli_fetch_array($query1);

//昨天
$sql2 = "select sum(amount)  as value from o_order where  date_format(create_time,'%Y-%m-%d')= date_format(date_sub(now(),interval 1 day),'%Y-%m-%d')  and  ( status=7 or  `status`=2 or `status`=3 or `status`=4 or `status`=5 ) ";

$query2=$mysqli->query($sql2);
$res2=mysqli_fetch_array($query2);



$jsonStr["all"] = number_format($res['value'],2);
$jsonStr["today"] = number_format($res1['value'],2);
$jsonStr["yesterday"] = number_format($res2['value'],2);
mysqli_close($mysqli); 

echo jsonSuccess($jsonStr);


?>